package net.pragyah.scalby.inference.exact

import net.pragyah.scalby.Variable
import scala.collection.mutable.Map

object EdgeTag{
  def apply[A](parent:Variable[A],child:Variable[A]) = new EdgeTag[A](parent,child)
}

class EdgeTag[A](val parent:Variable[A],val child:Variable[A]){
  
  val lambda = Map[A,float]() // lambda message for the 'a' value of the parent coming from the child variable
  val pi = Map[A,float]() // pi message for the 'a' value of the parent going down to the child variable
  
  parent.values.foreach(a =>{
                          lambda(a) = 1 // lambda messages are all 1 to begin with ... see the explaination in VertexTag class ... 
                                            //  L has a child C .. L has values l1 and l2 and C has values c1 and c2 -- 
                          //.... let P(c1|l1) = 0.6 and P(c2|l1) = 0.4
                           // now lambda-Message lambdaC(l1) =  P(c1|l1)*lambda(c1) + P(c2|l1)*lambda(c2) 
                           // now that lambda-values for C1 and C2 are 1 ... so lambdaC(l1) =P(c1|l1)*1 + P(c2|l1)*1 = 0.6 + 0.4 = 1
                           //This is universal and applies to all the children of L ... and of any node .... 

                        })
  
  
  
}
